/**
 * 
 */
package com.youth.fund.hk.hostManager.manager.dao.mybatis;

import java.sql.Timestamp;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.youth.fund.hk.hostManager.common.dao.mybatis.BaseMybatisDao;
import com.youth.fund.hk.hostManager.manager.dao.NewsDao;
import com.youth.fund.hk.hostManager.manager.datamodel.NewsModel;

/**
 * @author Sunk_Sky
 *
 * 2014年11月12日下午5:14:11
 */
@Repository("NewsDao")
public class NewsMybatisDaoImpl extends BaseMybatisDao<NewsModel, Integer>
		implements NewsDao
{
	private final static String CREATE = "news.create";

	private final static String DELETE = "news.delete";

	private final static String UPDATE = "news.update";

	private final static String QUERY_BY_CONDITION = "news.list_by_condition";

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.dao.ICommonDao#create(java.io.Serializable)
	 */
	@Override
	public boolean create(NewsModel model)
	{
		Timestamp timestamp = new Timestamp(System.currentTimeMillis());

		model.setSetup_time(timestamp);

		model.setUpdate_time(timestamp);

		return super.create(model, CREATE);
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.dao.ICommonDao#delete(java.io.Serializable)
	 */
	@Override
	public boolean delete(NewsModel model)
	{
		return super.delete(model, DELETE);
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.dao.ICommonDao#update(java.io.Serializable)
	 */
	@Override
	public boolean update(NewsModel model)
	{
		Timestamp timestamp = new Timestamp(System.currentTimeMillis());

		model.setUpdate_time(timestamp);
		
		return super.update(model, UPDATE);
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.dao.ICommonDao#query(java.io.Serializable)
	 */
	@Override
	public List<NewsModel> query(NewsModel model)
	{
		return super.query(model, QUERY_BY_CONDITION);
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.common.dao.ICommonDao#queryOne(java.io.Serializable)
	 */
	@Override
	public NewsModel queryOne(NewsModel model)
	{
		return super.queryOne(model, QUERY_BY_CONDITION);
	}

	/* (non-Javadoc)
	 * @see com.youth.fund.hk.hostManager.manager.dao.NewsDao#pageQuery(com.youth.fund.hk.hostManager.manager.datamodel.NewsModel, com.github.miemiedev.mybatis.paginator.domain.PageBounds)
	 */
	@Override
	public PageList<NewsModel> pageQuery(NewsModel condition, PageBounds bound)
	{
		return null;
	}

}
